/*
 * @Author: Zhang Kai
 * @Date: 2021-10-21 15:58:18
 * @LastEditors: Zhang Kai
 * @LastEditTime: 2021-10-28 18:40:20
 * @FilePath: /metricsx-standard-ui/src/api/index.ts
 */

/**
 * 此文件放置公共Api
 * 此文件放置公共Api
 * 此文件放置公共Api
 * 重要的事情说三遍！！！
 */

import http from '@/utils/http/index';

/**
 * 主题
 */
export const subjectDeepListApi = () => {
  return http.get('/metricsx/api/v1/subjects/simple-list');
};

/**
 * 收藏指标库
 */
export const createFavoriteMetrics = (id: number) => {
  return http.post(`/metricsx/api/v1/favorite-metrics/${id}`, {});
};

/**
 * 取消收藏指标库
 */
export const cancelFavoriteMetrics = (id: number) => {
  return http.put(`/metricsx/api/v1/favorite-metrics/${id}`, {}, '');
};

/**
 * 根据字典类型查所有枚举
 *  DEPARTMENT   指标关联部门
 *  UNIT         指标计量单位
 */
export const enumTypes = (type: string) => {
  return http.get(`/metricsx/api/v1/dictionary-config/enum-type/${type}`);
};

/**
 * 根据指标类型查询指标枚举
 * atomic   原子指标
 * derived  派生指标
 */
export const enumMetricsApi = (type: string) => {
  return http.get(`/metricsx/api/v1/enum/metrics/${type}`);
};

/**
 * 根据指标类型查询状态枚举
 * atomic   原子指标
 * derived  派生指标
 */
export const metricsReviewStatusApi = (type: string) => {
  return http.get(`/metricsx/api/v1/enum/metricsReviewStatus/${type}`);
};

/**
 * 获取用户
 */
export const getUserApi = (name: string) => {
  return http.get(`/metricsx/api/v1/user/${name}`);
};
